﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class my_plan : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack)
        {
        }
        else
        {
            if (Request["myuid"] == null)
            {
                TUser1.CheckUser(this);
                myuid.Text = Session["ecrm_uid"].ToString();
            }
            else
            {
                myuid.Text = Request["myuid"].ToString();
            }
            
            //设定状态
            TUser oUser = new TUser(myuid.Text);
            oUser.Select();
            string bigname = oUser.BigName;

            userstatus1.Text = "<a onclick='javascript:location.href=\"../user/user_myself.aspx\"' onmouseover='this.style.cursor=\"pointer\"' onmouseout='this.style.backgroundColor=\"\"'>" + bigname + "的设置</a>";
            userstatus2.Text = "<a onclick='javascript:location.href=\"../user/user_logout.aspx\"' onmouseover='this.style.cursor=\"pointer\"' onmouseout='this.style.backgroundColor=\"\"'>退出</a>";

            DateTime cdate = System.DateTime.Today;
            mytoday.Text = cdate.ToString("yyyy-MM-dd")+"&nbsp;"+TDateTime.GetWeekName((System.Convert.ToInt16(cdate.DayOfWeek)));

        }
    }

    private string DrawCal(DateTime cdate)
    {
        string result = "<table border=1>";

        DateTime WeekBDate = TDateTime.GetBDateOfWeek(cdate);
        DateTime WeekEDate = TDateTime.GetEDateOfWeek(cdate);
        int WeekNum = TDateTime.GetWeekNum(cdate);

        result += "<tr>";
        result += "<td>Times</td>";
        DateTime DTemp = WeekBDate;
        while (DTemp <= WeekEDate)
        {
            result += "<td>";
            result += DTemp.ToString("yyyy-MM-dd")+"<br>";
            result += TDateTime.GetWeekName(DTemp.DayOfWeek.ToString());
            result += "</td>";
            
            DTemp = DTemp.AddDays(1);
        }
        result += "</tr>";

        foreach (string stime in TDateTime.plantimes)
        {
            result += "<tr>";
            result += "<td>"+stime+"</td>";
            DTemp = WeekBDate;
            while (DTemp <= WeekEDate)
            {
                result += "<td>&nbsp;";
                //result += DTemp.ToString("yyyy-MM-dd") + "("+stime+")";
                result += "</td>";

                DTemp = DTemp.AddDays(1);
            }
            result += "</tr>";
        }

        result += "</table>";

        return result;
    }
}
